# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=playerctl
pkgver=2.4.1
pkgrel=3
pkgdesc="MPRIS command-line controller for music players"
url="https://github.com/altdesktop/playerctl"
arch="all"
license="LGPL-3.0-or-later"
makedepends="
	glib-dev
	gobject-introspection-dev
	meson
	"
checkdepends="
	dbus-x11
	py3-dbus-next
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-timeout
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/altdesktop/playerctl/archive/v$pkgver.tar.gz"

build() {
	abuild-meson \
		-Dgtk-doc=false \
		-Dintrospection=true \
		. output
	meson compile -C output
}

check() {
	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./output/playerctl"
	export PATH="$PATH:./output/playerctl"
	# Require dbus-daemon
	dbus-run-session -- pytest --asyncio-mode auto \
		--ignore test/test_daemon.py \
		--deselect test/test_basics.py::test_system_list_players
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	rm -f "$pkgdir"/usr/lib/*.a
}

sha512sums="
2d84f657b07c948cd6990d9e79c4eb6e83f97c387ac53c2322fc0adbeb853950fa935332233329e7555db7d157f3ced6498cc102edaffd78849ca1f7d4c49bdc  playerctl-2.4.1.tar.gz
"
